/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Class;

import java.io.File;
import javax.swing.filechooser.FileFilter;

/**
 *
 * @author Tomcat
 */
public class ImageFilter extends FileFilter {

    @Override
    public String getDescription() {
        return "Image File (*.jpg,*.png)";
    }

    @Override
    public boolean accept(File f) {
        if (f.isDirectory()) {
            return true;
        }

        if (f.isFile()) {
            String name = f.getName();
            if (name.endsWith(".jpeg") || name.endsWith(".jpg") || name.endsWith(".png") || name.endsWith(".bmp")) {
                return true;
            }
        }

        return false;
    }
}
